{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Highcharts Demos\n",
    "=========\n",
    "Stacked and grouped column: http://www.highcharts.com/demo/column-stacked-and-grouped\n",
    "--------------------------------------------------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe style=\"border:0;outline:none;overflow:hidden\" srcdoc=\"&lt;!DOCTYPE html&gt;\n",
       "&lt;html lang=&quot;en&quot;&gt;\n",
       "    &lt;head&gt;\n",
       "        &lt;meta charset=&quot;utf-8&quot; /&gt;\n",
       "        &lt;link href=&quot;https://www.highcharts.com/highslide/highslide.css&quot; rel=&quot;stylesheet&quot; /&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&gt;&lt;/script&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts.js&quot;&gt;&lt;/script&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts-more.js&quot;&gt;&lt;/script&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/modules/exporting.js&quot;&gt;&lt;/script&gt;\n",
       "    &lt;/head&gt;\n",
       "    &lt;body style=&quot;margin:0;padding:0&quot;&gt;\n",
       "                &lt;div id=&quot;container&quot; style=&quot;width:750px;height:600px;&quot;&gt;Loading....&lt;/div&gt;\n",
       "\n",
       "\n",
       "    &lt;script&gt;\n",
       "        $(function(){\n",
       "\n",
       "\n",
       " \n",
       "\n",
       "\n",
       "\n",
       "\n",
       "            Highcharts.setOptions({&quot;lang&quot;: {}, &quot;global&quot;: {}});\n",
       "            var option = {&quot;loading&quot;: {}, &quot;subtitle&quot;: {}, &quot;xAxis&quot;: {&quot;categories&quot;: [&quot;Apples&quot;, &quot;Oranges&quot;, &quot;Pears&quot;, &quot;Grapes&quot;, &quot;Bananas&quot;]}, &quot;title&quot;: {&quot;text&quot;: &quot;Total fruit consumtion, grouped by gender&quot;}, &quot;series&quot;: {}, &quot;labels&quot;: {}, &quot;yAxis&quot;: {&quot;title&quot;: {&quot;text&quot;: &quot;Number of fruits&quot;}, &quot;allowDecimals&quot;: false, &quot;min&quot;: 0}, &quot;chart&quot;: {&quot;width&quot;: 750, &quot;renderTo&quot;: &quot;container&quot;, &quot;height&quot;: 600}, &quot;tooltip&quot;: {&quot;formatter&quot;: function () {                        return &#x27;&lt;b&gt;&#x27; + this.x + &#x27;&lt;/b&gt;&lt;br/&gt;&#x27; +                            this.series.name + &#x27;: &#x27; + this.y + &#x27;&lt;br/&gt;&#x27; +                            &#x27;Total: &#x27; + this.point.stackTotal;                    }}, &quot;plotOptions&quot;: {&quot;column&quot;: {&quot;stacking&quot;: &quot;normal&quot;}}, &quot;credits&quot;: {&quot;enabled&quot;: false}, &quot;colors&quot;: {}, &quot;pane&quot;: {}, &quot;exporting&quot;: {}, &quot;drilldown&quot;: {}, &quot;navigation&quot;: {}, &quot;legend&quot;: {}};\n",
       "\n",
       "\n",
       "            var data = [{&quot;data&quot;: [5, 3, 4, 7, 2], &quot;type&quot;: &quot;column&quot;, &quot;name&quot;: &quot;John&quot;}, {&quot;data&quot;: [3, 4, 4, 2, 5], &quot;type&quot;: &quot;column&quot;, &quot;name&quot;: &quot;Joe&quot;}, {&quot;data&quot;: [2, 5, 6, 2, 1], &quot;type&quot;: &quot;column&quot;, &quot;name&quot;: &quot;Jane&quot;}, {&quot;data&quot;: [3, 0, 4, 4, 3], &quot;type&quot;: &quot;column&quot;, &quot;name&quot;: &quot;Janet&quot;}]\n",
       "            option.series = data;\n",
       "\n",
       " \n",
       "\n",
       "            var chart = new Highcharts.Chart(option);\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       " \n",
       "\n",
       "\n",
       "        \n",
       "    });\n",
       "        &lt;/script&gt;\n",
       "\n",
       "    &lt;/body&gt;\n",
       "&lt;/html&gt;\" height=600 width=750></iframe>"
      ],
      "text/plain": [
       "<highcharts.highcharts.highcharts.Highchart at 0x7fee4011c510>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from highcharts import Highchart\n",
    "\n",
    "H = Highchart(width=750, height=600)\n",
    "\n",
    "data1 = [5, 3, 4, 7, 2]\n",
    "data2 = [3, 4, 4, 2, 5]\n",
    "data3 = [2, 5, 6, 2, 1]\n",
    "data4 = [3, 0, 4, 4, 3]\n",
    "\n",
    "options = {\n",
    "\t'title': {\n",
    "        'text': 'Total fruit consumtion, grouped by gender'\n",
    "    },\n",
    "\n",
    "    'xAxis': {\n",
    "        'categories': ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']\n",
    "    },\n",
    "\n",
    "    'yAxis': {\n",
    "        'allowDecimals': False,\n",
    "        'min': 0,\n",
    "        'title': {\n",
    "            'text': 'Number of fruits'\n",
    "        }\n",
    "    },\n",
    "\n",
    "    'tooltip': {\n",
    "        'formatter': \"function () {\\\n",
    "                        return '<b>' + this.x + '</b><br/>' +\\\n",
    "                            this.series.name + ': ' + this.y + '<br/>' +\\\n",
    "                            'Total: ' + this.point.stackTotal;\\\n",
    "                    }\"\n",
    "    },\n",
    "    'plotOptions': {\n",
    "        'column': {\n",
    "            'stacking': 'normal'\n",
    "        }\n",
    "    }\n",
    "}\n",
    "H.set_dict_options(options)\n",
    "\n",
    "H.add_data_set(data1, 'column', 'John', stack='male' )\n",
    "H.add_data_set(data2, 'column', 'Joe', stack='male')\n",
    "H.add_data_set(data3, 'column', 'Jane', stack='female')\n",
    "H.add_data_set(data4, 'column', 'Janet', stack='female')\n",
    "\n",
    "H"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
